package javabase.concurrent;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class ThreadPoolTest {
	public static void main(String[] args) {
		ExecutorService threadPool = Executors.newFixedThreadPool(3);
		ExecutorService pool1 = Executors.newSingleThreadExecutor();
		for(int i=0; i<10; i++) {
			threadPool.execute(() -> {
				for(int j=0; j<10; j++) {
					System.out.println(Thread.currentThread().getName() + "loop of " + j);
				}
			});
		}
		
		
		Executors.newScheduledThreadPool(3).schedule(()-> {
			System.out.println("dek");
		}, 10, TimeUnit.SECONDS);
	}
}
